<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    function User(name, age, career, work) {
      this.name = name
      this.age = age
      this.career = career
      this.work = work
    }

    function Factory(name, age, career) {
      let works = []
      switch(career) {
        case "coder": 
          works = ['写代码','写系分', '修Bug'] 
          break
        case "product manager": 
          works = ['订会议室', '写PRD', '催更']
          break
        case "boss": 
          works = ['喝茶', '看报', '见客户']
          break
        case "others": 
          works = ['未知']
          break
      }

      return new User(name, age, career, work)
    }


  </script>
</body>
</html>